

/**
 * @author Sunil Agrawal
 *
 */
import java.sql.DriverManager;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.Statement;

public class ConnectionPool {
	private static Connection con;
	private Statement st;

	
	public static Connection createConnection() {
		try {
			//Class.forName("com.mysql.jdbc.Driver").newInstance();
			Class.forName("com.mysql.jdbc.Driver");
			con = DriverManager.getConnection("jdbc:mysql://dataserver1/test?user=ultra&password=ultra");
			//con = DriverManager.getConnection("jdbc:mysql://175.41.140.4/smulraat_myvcdb?user=smulraat_vcdbusr&password=Use972@vDbMobApp");
			//con = DriverManager.getConnection("jdbc:mysql://dataserver1/myvcdbnew?user=ultra&password=ultra");
			
		} catch (Exception e) {
			e.printStackTrace();
		}
		return con;
	}

	public Statement getstatement() {
		try {
			
			if(con==null){
				con = createConnection();
			}
			if(st==null){
				st = con.createStatement(ResultSet.CONCUR_READ_ONLY,ResultSet.TYPE_SCROLL_SENSITIVE);
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
		return st;
	}
}